//---------------------------------------------------------------------------------
// Copyright (c) 2008 VoiceLynx Project
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
//     1. The origin of this software must not be misrepresented; you must not
//        claim that you wrote the original software. If you use this software
//        in a product, an acknowledgment in the product documentation would be
//        appreciated but is not required.
//
//     2. Altered source versions must be plainly marked as such, and must not be
//        misrepresented as being the original software.
//
//     3. This notice may not be removed or altered from any source
//        distribution.
//---------------------------------------------------------------------------------

#ifndef __VLTypes_h__
#define __VLTypes_h__

#include "VLPrerequisites.h"

struct VLCodecDescription
{
  virtual ~VLCodecDescription();

  VLString codecName;
  VLU32    sampleRate;
};

typedef std::auto_ptr<VLCodecDescription> VLCodecDescriptionPtr;

struct VLSpeexCodecDescription : public VLCodecDescription
{
  VLU8 quality;
  VLU8 complexity;
};

//! Represents a channel that can be joined/left
//struct VLChannel
//{
//  VLU32                 channelID;
//  VLString              channelName;
//  VLCodecDescriptionPtr description;
//};
//
//typedef std::vector<VLChannel> VLChannelList;

enum VLEDisconnectReason
{
  VL_DR_UNKNOWN,
  VL_DR_AUTH_REQUIRED, // When connecting, an Auth packet must be sent, even if the
                       // server doesn't need a password. The auth packet includes the
                       // name of the user, and could include a password
  VL_DR_AUTH_FAILED    // The server did not accept the auth packet that was sent
                       // (duplicate user name, no/bad password, etc.)
};

struct VLPeer;

#define VL_USERID_SELF (-1) // Clients only get user notifications about other clients,
                            // so they make their own VLUser locally so that there can
                            // be a consistant interface for other users and the local
                            // user. To tell if a VLUser represents the local user,
                            // compare the user id to VL_USERID_SELF
typedef VL32 VLUserId;

//! Represents a user that can be muted/unmuted, etc.
struct VLUser
{
  VLUser();
  virtual ~VLUser();

  VLPeer  *peer;
  VLU32    connectTime;
  bool     isAuthenticated;
  VLUserId userId;
  VLString userName;

  //VLUserId   userID;
  //VLString username;
  //VLF32    txActivity;
  //VLString message;
  //VLU8     status;
  //VL32     hearableBitmask;
};

typedef std::auto_ptr<VLUser> VLUserPtr;
typedef std::map<VLUserId, VLUser *> VLUserIdToUserMap;
typedef VLPtrList<VLUser> VLUserList;

struct VLPeer
{
  VLUser  *user;
};

typedef std::auto_ptr<VLPeer> VLPeerPtr;
typedef VLPtrList<VLPeer> VLPeerList;

#endif